﻿@using E5_KhuyenMaiVang.Models;
@model IEnumerable<COMMENT>
@{
    ViewBag.Title = "Detail";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    var CommentList = Model;
    DEAL CurrentDeal = ViewBag.CurrentDeal;
    int nComment = CommentList.Count();
 }

<div id="random_deal">
    <h3>        
       @CurrentDeal.Description
    </h3>
    <br/>
    <table width="100%" style=" border-left-style: groove; 
border-left-color: green; 
border-left-width: 15px; 
border-bottom-style: ridge; 
border-bottom-color: yellow; 
border-bottom-width: 25px;" >
        <tr>
            <td style="border-style: ridge; border-width: medium;">
                <table width="100%">
                <tr><p><small><a name="fb_share" type="icon_link" 
    share_url="www.hcmus.edu.vn">Chia sẻ trên facebook</a></small></p> 
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 
        type="text/javascript">
</script></tr>
                <tr><img src="@CurrentDeal.Image"
                    alt="" title="" height="400" width="404" /></tr>
                <tr>
                    <iframe src="http://www.facebook.com/plugins/like.php?href=http://www.hcmus.edu.vn&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>
                </tr>
                </table>                
            </td>
            <td valign="top">
                <table width="100%">
                    <tr>
                        <td align="left">
                            <div class="addr_deals">
                                <span>
                                    <img src="http://khuyenmaivang.vn/layout/images/home-icon.jpg" alt="" />
                                    14A, Sông Đà, P.2, Q.Tân Bình, Tp.HCM </span>
                            </div>
                        </td>
                        <td align="right">
                            <div class="addr_deals">
                                <span>
                                    <img src="http://khuyenmaivang.vn/layout/images/voucher-icon.jpg" alt="" />
                                    Giao hàng tận nơi </span>
                            </div>
                        </td>
                    </tr>
                </table>
                <table>
                <tr>
                <div id="random_deal_static2">
                    <span id="time_deal">
                        <p style="font-size: 15px; padding-top: 5px">
                            Giá bán: <b style="font-size: 25px; color: #FFAA00">@CurrentDeal.Discount</b> VND</p>
                    </span><span id="count_buy">
                        <div id="view-btn">
                            <a href="@Url.Action("Cart", "Member", new { id = @CurrentDeal.DealID })" title="Mua">Mua</a>
                        </div>
                    </span>
                </div>
                </tr>
                <tr>
                <div class="random_deal_wrp prices_show">
                    <div id="price1">
                        Giá thị trường<br />
                        <span>@CurrentDeal.Price</span>
                    </div>
                    <div id="price2">
                        Tiết kiệm<br />
                        <span style="font-size: 15pt">@((int)((CurrentDeal.Discount * 100) / CurrentDeal.Price))%</span>
                    </div>
                    <div id="rate_sale">
                        Thời gian còn lại<br />
                        <span> @{                            
                            var DealTime = @CurrentDeal.EndDate.ToString("yyyy-M-d HH:mm:ss") + " GMT+00:00";
                            var IDDealTime = "countdown1";
                        <p id="@IDDealTime">@DealTime</p>
                        }</span>
                    </div>
                </div>
                </tr>
                <tr>
                <div class="buy">
                    <img src="http://khuyenmaivang.vn/layout/images/buycount-01.jpg" alt="" />
                    <p>Đã bán được @CurrentDeal.SoldQuantity deals. <b style="color:#97C30A">@CurrentDeal.DEAL_STATUS.StatusName</b></p>
                    <br />
                    <br />
                    <p><b style="color:#1589FF">Những điểm lưu ý:</b></p>
                    <p>@CurrentDeal.Spec</p>
                </div>
                </tr>
               
                </table>          
            </td>
        </tr>
    </table>    
</div>
<script type="text/javascript">
    function toggle(element) {
        document.getElementById(element).style.display = (document.getElementById(element).style.display == "none") ? "" : "none";
    }
</script>
<div id="random_deal">
    <h3><a href="javascript:toggle('googlemap')">Bản đồ:</a></h3>
     <div id="googlemap">
     @if (CurrentDeal.MapLink != null)
     { 
      <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=5+G%C3%B2+D%E1%BA%A7u,+Ho+Chi+Minh,+Ho+Chi+Minh+City,+Vietnam&amp;aq=0&amp;oq=5+go+dau+ho+c&amp;sll=37.0625,-95.677068&amp;sspn=37.188995,79.013672&amp;ie=UTF8&amp;hq=&amp;hnear=https://maps.google.com/maps?q=5+G%C3%B2+D%E1%BA%A7u,+Ho+Chi+Minh,+Ho+Chi+Minh+City,+Vietnam&hl=en&ie=UTF8&sll=37.0625,-95.677068&sspn=37.188995,79.013672&oq=5+go+dau+ho+c&hnear=5+G%C3%B2+D%E1%BA%A7u,+T%C3%A2n+Qu%C3%BD,+T%C3%A2n+Ph%C3%BA,+Ho+Chi+Minh+City,+Vietnam&t=m&z=16&amp;t=m&amp;z=14&amp;ll=10.795879,106.623704&amp;output=embed"></iframe>
     }
     else
     {
         <div class="ui-widget">
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>Hey!</strong> Không có map.</p>
			</div>
		</div>
     }
         </div>
</div>
<div id="random_deal">
     
     <h3><a href="javascript:toggle('companyDetail')">Thông tin doanh nghiệp:</a></h3>
    <div id="companyDetail">       
        <div id="random_deal">
        <table border="0">  
        <tr>
        <td>
             <div class="buy">      
            <p><b style="color:#1589FF">@CurrentDeal.COMPANY.CompanyName</b></p>  
            <br />
            <p>Địa chỉ: @CurrentDeal.COMPANY.Address</p>
             <br />
            <p>Email: <a>@CurrentDeal.COMPANY.Email</a></p>
             <br />
            <p>Website: <a href="@CurrentDeal.COMPANY.Website">@CurrentDeal.COMPANY.Website</a></p>
             <br />
            <p>Liên lạc: @CurrentDeal.COMPANY.Phone</p>
             <br />
            <p>Mã số thuế: @CurrentDeal.COMPANY.TaxCode</p>
             <br />
            <p>Về doanh nghiệp chúng tôi: @CurrentDeal.COMPANY.Description</p>
            </div>
            </td>
            <td></td>
            </tr>
            </table>
            </div>
        </div>
    </div>
    <div id="random_deal">
<h3><a href="javascript:toggle('comment')">Các bình luận:</a></h3>
<div id="comment">
<div id="random_deal">
     @if (Session["LogOn"] != null)
     {                      
                <p><b style="color:#1589FF">Viết bình luận cho deal này:</b></p>  
                    <br />      
                <div id="Postcomment">
                    <form action="PostComment" method="post">
                        <small>Tên      :</small><input name="Name" type="text" value="@Session["LogOn"]"/>                     
                        <small>Email    :</small><input name="Email" type="text" />
                        <br />
                        <br />
                        <small>Bình luận:</small><textarea name="Content" cols="36" rows="2"></textarea>
                        <br />       
                        <input name="dealID" type="hidden" value="@CurrentDeal.DealID" />            
                         <input class="submit-form" name="PostComment" value="Đồng ý" type="submit" />
                    </form>
                </div>            
     }  
 </div>
@if (CommentList != null && nComment != 0)
{
    foreach (var comment in CommentList)
    {
    <div id="random_deal">
    <p><small><b style="color:#1589FF">@comment.PostName</b></small> <small><i>@comment.PostDate</i></small></p>
    <br />
    <p>@comment.Text</p>
    </div>
    }
    if (CommentList.Count() > 10)
    { 
         if (Session["LogOn"] != null)
         {                      
                <p><b style="color:#1589FF">Viết bình luận cho deal này:</b></p>  
                    <br />      
                <div id="Postcomment">
                    <form action="PostComment" method="post">
                        <small>Tên      :</small><input name="Name" type="text" value="@Session["LogOn"]"/>                     
                        <small>Email    :</small><input name="Email" type="text" />
                        <br />
                        <br />
                        <small>Bình luận:</small><textarea name="Content" cols="36" rows="2"></textarea>
                        <br />       
                        <input name="dealID" type="hidden" value="@CurrentDeal.DealID" />            
                         <input class="submit-form" name="PostComment" value="Đồng ý" type="submit" />
                    </form>
                </div>            
         } 
    }
}
else
{ 
    <div class="ui-widget">
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>Hey!</strong> Không có bình luận.</p>
			</div>
		</div>
}
</div>
        </div>
</div>
<table width="100%">
</table>
 <script type="text/javascript">
     $("#comment").hide();
     $("#companyDetail").hide();
     $("#googlemap").hide();
 </script>